package com.cisetech.util;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;


public class ResponseMessage {
	public void responsem(HttpServletResponse response,Map map){
		PrintWriter out=null;
		response.setContentType("application/json");  
		JSONObject Json = new JSONObject();
		try {
			out = response.getWriter();
			Json.put("message",map);
			Json.put("start","200");
			out.print(Json.toString());
		} catch (IOException e) {
			Json.put("start","201");
			out.print(Json.toString());
			e.printStackTrace();
		}finally{
			out.flush();
			out.close();
			out = null;
		}
	}
	public void responStr(HttpServletResponse response,String str){
		PrintWriter out=null;
		response.setContentType("application/json");  
		try {
			out = response.getWriter();
			out.print(str);
		} catch (IOException e) {
			out.print("0");
		}finally{
			out.flush();
			out.close();
			out = null;
		}
	}
}
